package com.ssm.anno.config;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * @author: Hsiao
 * @date: 2023-11-22
 * @description: 代替web.xml
 */
public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer{
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[]{SpringConfig.class};
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{WebConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }

    // @Override
    // protected Filter[] getServletFilters() {
    //     CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
    //     characterEncodingFilter.setEncoding("UTF-8");
    //     characterEncodingFilter.setForceResponseEncoding(true);
    //
    //     HiddenHttpMethodFilter hiddenHttpMethodFilter = new HiddenHttpMethodFilter();
    //
    //     return new Filter[]{characterEncodingFilter,hiddenHttpMethodFilter};
    // }
}
